package com.apiit.webserviceclient.activities;

import com.apiit.webserviceclient.R;
import com.apiit.webserviceclient.R.layout;
import com.apiit.webserviceclient.R.menu;
import android.os.Bundle;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.view.Menu;
import android.widget.TabHost;

public class RenewalsTab extends TabActivity {

	private TabHost tabhost;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_renewals_tab);

		tabhost = getTabHost();
		TabHost.TabSpec spec;
		Intent intent;
		
		Intent intename = getIntent();
		String patronNovalue = intename.getStringExtra("patronNo");
		String namevalue = intename.getStringExtra("name");
		String stausvalue = intename.getStringExtra("status");
		String datevalue = intename.getStringExtra("expDate");
		String messagevalue = intename.getStringExtra("message");

		// Search
		intent = new Intent(this, OPACsearch.class);
		spec = tabhost.newTabSpec("Search").setIndicator("Search")
				.setContent(intent);
		tabhost.addTab(spec);

		// Reservations
		intent = new Intent(this, LibraryReservations.class);
		spec = tabhost.newTabSpec("Reservations").setIndicator("Reservations")
				.setContent(intent);
		tabhost.addTab(spec);

		// Fines
		intent = new Intent(this, LibraryFines.class);
		spec = tabhost.newTabSpec("Fines").setIndicator("Fines")
				.setContent(intent);
		tabhost.addTab(spec);

		// Renewals
		intent = new Intent(this, LibraryRenewals.class);
		intent.putExtra("patronNo", patronNovalue);	
		intent.putExtra("Name", namevalue);
		intent.putExtra("Status", stausvalue);
		intent.putExtra("expDate", datevalue);
		intent.putExtra("message", messagevalue);
		spec = tabhost.newTabSpec("Renewals").setIndicator("Renewals")
				.setContent(intent);
		tabhost.addTab(spec);

		tabhost.setCurrentTab(3);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.renewals_tab, menu);
		return true;
	}

}
